
 ProjectionOrtho  = function(left, right, bottom, top, near, far)
{
	/********************************************
	/*				Properties					
	/********************************************/
	
		this.m_Left;	
		this.m_Right;	
		this.m_Bottom;	
		this.m_Top;	
		this.m_Near;	
		this.m_Far;
		
		this.m_Matrix;		/*!< Store the Orthogonal projection Matrix passed to the Shaders	*/
		this.m_Inverse;		/*!< Store the inverse Matrix. Can be used to convert mouse coordinates to world coordinate	*/
	
	/********************************************
	/*				Constructor					
	/********************************************/
		
		this.ComputeProjection(left, right, bottom, top, near, far);
}

	
/********************************************
/*				Methods						
/********************************************/

	ProjectionOrtho.prototype.ComputeProjection = function(left, right, bottom, top, near, far)
	{
		this.m_Left		=	left;	
		this.m_Right	=	right;	
		this.m_Bottom	= 	bottom;	
		this.m_Top 		= 	top;	
		this.m_Near 	= 	near;	
		this.m_Far 		= 	far;
			
		this.ComputeMatrix(left, right, bottom, top, near, far);
		this.ComputeInverse(left, right, bottom, top, near, far);
	}

	ProjectionOrtho.prototype.ComputeMatrix = function(left, right, bottom, top, near, far)
	{
		this.m_Matrix	=	new Matrix4();

		var r_l	=	right-left;
		var rl = right + left;
		
		var t_p = top-bottom;
		var tp = top + bottom;
		
		var n_f = far - near;
		var nf = near + far;
		
		this.m_Matrix.array[0]=2/(r_l); 		this.m_Matrix.array[1]=0; 				this.m_Matrix.array[2]=0;                    	this.m_Matrix.array[3]= - (rl / r_l);
		this.m_Matrix.array[4]=0; 				this.m_Matrix.array[5]=2/(t_p); 		this.m_Matrix.array[6]=0;                   	this.m_Matrix.array[7]=	-( tp/ t_p);
		this.m_Matrix.array[8]=0; 				this.m_Matrix.array[9]=0; 				this.m_Matrix.array[10]=-2/(n_f); 				this.m_Matrix.array[11]=-	(nf / n_f);
		this.m_Matrix.array[12]=0;				this.m_Matrix.array[13]=0; 				this.m_Matrix.array[14]=0;                  	this.m_Matrix.array[15]=1;
	}

	ProjectionOrtho.prototype.ComputeInverse = function(left, right, bottom, top, near, far)
	{
		this.m_Inverse	=	new Matrix4();

		var r_l		=	right-left;
		var rl 		= right + left;
		
		var t_p 	= top-bottom;
		var tp 		= top + bottom;
		
		var n_f = far - near;
		var nf = near + far;
		
		this.m_Inverse.array[0]=(r_l)/2; 		this.m_Inverse.array[1]=0; 				this.m_Inverse.array[2]=0;                    	this.m_Inverse.array[3]=  (rl)/2;
		this.m_Inverse.array[4]=0; 				this.m_Inverse.array[5]=(t_p)/2; 		this.m_Inverse.array[6]=0;                   	this.m_Inverse.array[7]=	 (tp)/2;
		this.m_Inverse.array[8]=0; 				this.m_Inverse.array[9]=0; 				this.m_Inverse.array[10]=(n_f)/-2; 				this.m_Inverse.array[11]=	(nf)/-2;
		this.m_Inverse.array[12]=0;				this.m_Inverse.array[13]=0; 			this.m_Inverse.array[14]=0;                  	this.m_Inverse.array[15]=1;
	}

